<template>
  <div class="tijian-wrapper">
    <div class="sub-banner">
      <!-- <img :src="`${staticPath}/img_hulidaojia@2x.png`" alt=""> -->
      <van-swipe
        vertical
        class="huli-wrapper"
        :autoplay="3000"
        :show-indicators="false"
      >
        <van-swipe-item v-for="(item,index) in bannerList.subscribe.poster" :key="index" @click="$router.push({path: '/huli/index'})">
          <img :src="item.picurl" alt="" srcset="">
        </van-swipe-item>
      </van-swipe>
    </div>
    <div class="service-panel">
      <div class="huli-common-title">
        <h3><em></em>热门推荐 <span class="right-arrow">更多热门 ></span></h3>
      </div>
    

    <div class="service-item" v-if="checkList.length > 0">
      <div class="items-wrapper">
        <div class="pic-wrapper" v-for="(item,index) in checkList" :key="index" @click="() => $router.push({path: `/user/medical/detail/${item.id}`})">
          <img :src="item.picurl[0]" alt="" srcset="">
          <div class="thrunmb">
            <div class="top">
              <p class="title">{{item.name}}</p>
              <div class="flex-desc">
                {{item.abstract}}
              </div>
            </div>
            <div class="bottom">
              <em>￥</em>{{item.price}}<em>元</em> <span class="line-price">￥{{item.lineation}}</span>
            </div>
          </div>
        </div>
        
      </div>
      </div>

      <van-empty description="暂无数据" v-else />

      <div class="fixed-bottom">
        <van-pagination v-model="currentPage" :page-count="pageCount" @change="handlePage" mode="simple" />
      </div>
    </div>
  </div>
</template>

<script>
import { checksListServer } from '@/service/server';
import { mapGetters } from 'vuex';
export default {
  data(){
    return {
      currentPage: 1,
      staticPath: process.env.VUE_APP_STATIC_PATH,
      checkList: [],
      pageCount: 0,
    }
  },
  created(){
    this.queryCheckList();
  },
  computed: {
    ...mapGetters(['bannerList'])
  },
  methods:{
    handlePage(e){
      this.currentPage = e;
    },
    async queryCheckList(){
      let result = await checksListServer();
      if(result.status == 200){
        this.checkList = result.data.model
        if(result.data.model.length > 0){
          this.pageCount = result.data._meta.pageCount
        }
      }else{
        this.$toast(result.message)
      }
    },
  },
  components:{
    
  }
}
</script>

<style lang="less">
@import '~@/assets/less/mixin.less';
.fixed-bottom{
  width: 100%;
  // position: fixed;
  bottom: 70px;
  padding: 10px;
  padding-bottom: 60px;
}
.sub-banner{
  width: 100%;
  height: 150px;
}
img{
  width: 100%;
}
.tijian-wrapper{
  background: #f5f5f5;
  .items-wrapper{
  padding: 15px 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  .pic-wrapper{
    width: 48%;
    flex-basis: 48%;
    background: #fff;
    border-radius: 10px;
    img{
      width: 100%;
      height: 150px;
    }
    margin-right: 4%;
    margin-bottom: 12px;
    &:nth-child(2n){
      margin-right: 0;
    }
  }
  
  .thrunmb{
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-direction: column;
    padding: 14px 10px;
    .top{
      flex: 1;
      display: flex;
      justify-content: space-around;
      align-items: flex-start;
      flex-direction: column;
      margin-bottom: 12px;
      .title{
        font-size: 16px;
        color: #000;
        margin-bottom: 5px;
      }
      .flex-desc{
        height: 44px;
        padding-top: 6px;
        color: #999;
        line-height: 1.5;
        .ellipsisLine(2)
      }
    }
    .bottom{
      color: #E02E2E;
      font-size: 18px;
      display: flex;
      align-items: flex-end;
      width: 100%;
      justify-content: flex-start;
      i{
        font-size: 13px;
      }
      .line-price{
        color: #999;
        font-size: 13px;
        margin-left: 6px;
      }
    }
  }
}
  .huli-common-title {
    margin-bottom: 15px;
    .right-arrow {
      display: flex;
      justify-content: flex-end;
      color: #999;
      font-size: 13px;
      flex: 1;
    }
    h3 {
      font-size: 16px;
      margin-bottom: 15px;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      em {
        display: inline-block;
        width: 5px;
        height: 17px;
        background: linear-gradient(0deg, #fcc9cb, #f7757b);
        border-radius: 5px;
        margin-right: 6px;
      }
    }
  }
}
.service-panel{
  border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    position: relative;
    z-index: 1;
    margin-top: -10px;
    padding: 15px;
    background: #F8F8F8;
    .service-title{
      font-size: 16px;
      color: #000;
      padding: 0 10px;
    }
}
.service-item{
  .custom-title{
    display: flex;
    justify-content: flex-start;
    font-size: 16px;
    color: #000;
  }
    .van-cell__value{
      font-size: 13px;
      flex: none;
    }
}
.van-grid-item__content,.van-cell{
    background: #F8F8F8;
  }

</style>